<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>深入理解 Zookeeper ACL 权限控制机制</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* 首字下沉效果 */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #4f46e5;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* 代码块美化 */
        .code-block {
            background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
            border-radius: 12px;
            padding: 1.5rem;
            margin: 1.5rem 0;
            position: relative;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        }
        
        .code-block::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, #4f46e5, #7c3aed, #ec4899);
        }
        
        .code-block code {
            color: #e2e8f0;
            font-family: 'Fira Code', monospace;
            font-size: 0.9rem;
            line-height: 1.6;
        }
        
        /* 卡片悬停效果 */
        .feature-card {
            transition: all 0.3s ease;
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        /* 权限标签样式 */
        .permission-tag {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.875rem;
            font-weight: 500;
            margin: 0.25rem;
            transition: all 0.2s ease;
        }
        
        .permission-tag:hover {
            transform: scale(1.05);
        }
        
        /* 渐变文字效果 */
        .gradient-text {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* 章节标题装饰 */
        .section-title {
            position: relative;
            padding-left: 1.5rem;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 100%;
            background: linear-gradient(180deg, #4f46e5, #7c3aed);
            border-radius: 2px;
        }
        
        /* 列表项美化 */
        .custom-list li {
            position: relative;
            padding-left: 2rem;
            margin-bottom: 1rem;
        }
        
        .custom-list li::before {
            content: '\f058';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            position: absolute;
            left: 0;
            top: 0.25rem;
            color: #4f46e5;
        }
        
        /* Mermaid 图表容器 */
        .mermaid-container {
            background: white;
            border-radius: 12px;
            padding: 2rem;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero 区域 -->
    <section class="relative overflow-hidden">
        <div class="absolute inset-0 bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 opacity-90"></div>
        <div class="relative z-10 container mx-auto px-6 py-24">
            <div class="text-center text-white">
                <h1 class="text-5xl md:text-7xl font-bold mb-6 animate-pulse">
                    <i class="fas fa-shield-alt mr-4"></i>
                    Zookeeper ACL
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">深入理解分布式系统的权限控制机制</p>
                <div class="flex justify-center space-x-4">
                    <span class="permission-tag bg-white text-indigo-600">
                        <i class="fas fa-lock mr-2"></i>安全控制
                    </span>
                    <span class="permission-tag bg-white text-purple-600">
                        <i class="fas fa-user-shield mr-2"></i>访问管理
                    </span>
                    <span class="permission-tag bg-white text-pink-600">
                        <i class="fas fa-key mr-2"></i>权限配置
                    </span>
                </div>
            </div>
        </div>
        <div class="absolute bottom-0 left-0 right-0">
            <svg viewBox="0 0 1440 120" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M0 120L60 110C120 100 240 80 360 70C480 60 600 60 720 65C840 70 960 80 1080 85C1200 90 1320 90 1380 90L1440 90V120H1380C1320 120 1200 120 1080 120C960 120 840 120 720 120C600 120 480 120 360 120C240 120 120 120 60 120H0V120Z" fill="white"/>
            </svg>
        </div>
    </section>

    <!-- 主要内容区域 -->
    <main class="container mx-auto px-6 py-12 max-w-6xl">
        <!-- 引言卡片 -->
        <div class="feature-card rounded-2xl p-8 mb-12 border-l-4 border-indigo-500">
            <p class="text-lg leading-relaxed text-gray-700 drop-cap">
                Zookeeper 的 ACL（访问控制列表）用于控制对 Zookeeper 节点的访问权限。它为每个节点定义了谁可以读取、写入或修改该节点的数据。ACL 是 Zookeeper 的重要安全特性之一，用于确保只有授权的用户或应用可以访问或修改特定的节点数据。
            </p>
        </div>

        <!-- ACL 工作原理 -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-title gradient-text">
                <i class="fas fa-cogs mr-3"></i>ACL 的工作原理
            </h2>
            
            <div class="grid md:grid-cols-3 gap-6 mb-8">
                <div class="feature-card rounded-xl p-6 text-center">
                    <div class="text-4xl mb-4 text-indigo-500">
                        <i class="fas fa-shield-alt"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">定义权限</h3>
                    <p class="text-gray-600">ACL 定义了不同的权限类型，包括 READ、WRITE、CREATE、DELETE 和 ADMIN，精确控制节点操作。</p>
                </div>
                
                <div class="feature-card rounded-xl p-6 text-center">
                    <div class="text-4xl mb-4 text-purple-500">
                        <i class="fas fa-user-check"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">授权标识</h3>
                    <p class="text-gray-600">每个 ACL 条目包含授权标识和对应权限，支持多种认证方式，确保身份验证的灵活性。</p>
                </div>
                
                <div class="feature-card rounded-xl p-6 text-center">
                    <div class="text-4xl mb-4 text-pink-500">
                        <i class="fas fa-gavel"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3">访问控制</h3>
                    <p class="text-gray-600">Zookeeper 根据节点 ACL 检查客户端身份和权限，不匹配则拒绝操作，保障数据安全。</p>
                </div>
            </div>

            <!-- 权限类型展示 -->
            <div class="bg-gradient-to-r from-indigo-50 to-purple-50 rounded-2xl p-8 mb-8">
                <h3 class="text-2xl font-semibold mb-6 text-gray-800">
                    <i class="fas fa-list-check mr-3 text-indigo-500"></i>权限类型详解
                </h3>
                <div class="grid md:grid-cols-2 gap-4">
                    <div class="bg-white rounded-lg p-4 shadow-sm">
                        <h4 class="font-semibold text-lg mb-3 text-indigo-600">认证方式</h4>
                        <ul class="custom-list">
                            <li><code class="bg-gray-100 px-2 py-1 rounded">world</code> - 所有人都可访问</li>
                            <li><code class="bg-gray-100 px-2 py-1 rounded">auth</code> - 已认证用户</li>
                            <li><code class="bg-gray-100 px-2 py-1 rounded">digest</code> - 用户名密码认证</li>
                            <li><code class="bg-gray-100 px-2 py-1 rounded">x509</code> - 证书认证</li>
                            <li><code class="bg-gray-100 px-2 py-1 rounded">ip</code> - IP 地址认证</li>
                        </ul>
                    </div>
                    <div class="bg-white rounded-lg p-4 shadow-sm">
                        <h4 class="font-semibold text-lg mb-3 text-purple-600">操作权限</h4>
                        <ul class="custom-list">
                            <li><code class="bg-gray-100 px-2 py-1 rounded">read</code> - 读取节点数据</li>
                            <li><code class="bg-gray-100 px-2 py-1 rounded">write</code> - 修改节点数据</li>
                            <li><code class="bg-gray-100 px-2 py-1 rounded">create</code> - 创建子节点</li>
                            <li><code class="bg-gray-100 px-2 py-1 rounded">delete</code> - 删除子节点</li>
                            <li><code class="bg-gray-100 px-2 py-1 rounded">admin</code> - 管理权限设置</li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>

        <!-- ACL 工作流程图 -->
        <section class="mb-16">
            <div class="mermaid-container">
                <h3 class="text-2xl font-semibold mb-6 text-center gradient-text">ACL 权限验证流程</h3>
                <div class="mermaid">
                    graph TD
                        A[客户端请求] --> B{身份验证}
                        B -->|通过| C[获取节点ACL]
                        B -->|失败| D[拒绝访问]
                        C --> E{权限检查}
                        E -->|有权限| F[执行操作]
                        E -->|无权限| G[拒绝操作]
                        F --> H[返回结果]
                        G --> I[返回错误]
                        
                        style A fill:#4f46e5,stroke:#333,stroke-width:2px,color:#fff
                        style F fill:#10b981,stroke:#333,stroke-width:2px,color:#fff
                        style D fill:#ef4444,stroke:#333,stroke-width:2px,color:#fff
                        style G fill:#ef4444,stroke:#333,stroke-width:2px,color:#fff
                </div>
            </div>
        </section>

        <!-- 配置权限控制 -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-title gradient-text">
                <i class="fas fa-tools mr-3"></i>如何配置 Zookeeper 的权限控制
            </h2>

            <!-- 配置步骤 -->
            <div class="space-y-8">
                <!-- 创建带 ACL 的节点 -->
                <div class="feature-card rounded-xl p-8">
                    <h3 class="text-2xl font-semibold mb-4 flex items-center">
                        <span class="bg-indigo-500 text-white